Nginx Docker 最小構成
フォルダ構成
code:sh
❯ tree
.
├── Dockerfile
├── docker-compose.yml
├── nginx.conf
└── src
└── index.html
1 directory, 4 files
code:Dockerfile
FROM nginx:1.19.1
COPY nginx.conf /etc/nginx/nginx.conf
COPY src /var/www/html
EXPOSE 80
code:docker-compose.yml
version: '3'
services:
server:
build: .
ports:
- 8080:80
volumes:
- ./src:/var/www/html
code:nginx.conf
events {}
http {
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
server {
listen 80;
server_name server;
root /var/www/html;
index index.html;
}
}